package com.situ.blog.controller;

import com.situ.blog.pojo.vo.TypeCountVO;
import com.situ.blog.pojo.vo.UserCountVO;
import com.situ.blog.service.IChartService;
import com.situ.blog.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/chart")
public class ChartController {
    @Autowired
    private IChartService chartService;


    @RequestMapping("/selectTypeCount")
    public Result selectTypeCount() {
        List<TypeCountVO> list = chartService.selectTypeCount();
        return Result.ok(list);
    }

    @GetMapping("/selectTotalCount")
    public Result selectTotalCount() {
        Map<String, Long> map =  chartService.selectTotalCount();
        return Result.ok(map);
    }

    @GetMapping("/selectUserCount")
    public Result selectUserCount() {
        List<UserCountVO> list = chartService.selectUserCount();
        return Result.ok(list);
    }
}
